import axios from 'axios'
import qs from 'qs'
let base = 'http://data.yunsuns.com/'
export const getPaymentParams = params => {
  return axios.post(`${base}base/pay/getPaymentParams?` + qs.stringify(params), {

  })
}
export const recharge=params=>{
  return axios.post(`${base}wechat/wxApps/api/recharge?orderId=`+params.orderId,params);
}
export const getUserData = params => {
  return axios.get(`${base}wechat/getUserData/${params.code}`, {params: params})
}
export const saveArticle=params=>{
  return axios.post(`${base}wechat/wxApps/api/saveArticle`,params);
}
export const getWeChatConfigParams=params=>{
  return axios.post(`${base}wechat/getWeChatConfigParams?appId=${params.appId}&url=${encodeURI(params.url)}`,{})
}
export const getArticle=params=>{
  return axios.post(`${base}wechat/wxApps/api/getArticle?article=${params.article}`,params);
}
export const getArticlePayedList=params=>{
  return axios.post(`${base}wechat/wxApps/api/getArticlePayedList?articleId=${params.articleId}`,{});
}
export const addUserToPayedList=params=>{
  return axios.post(`${base}wechat/wxApps/api/addUserToPayedList?id=${params.articleId}&orderId=${params.orderId}&openid=${params.openid}&headimgurl=${params.headimgurl}`,{})
}
export const getArticleList=params=>{
  return axios.post(`${base}wechat/wxApps/api/getArticleList?openid=${params.openid}`,params)
}

export const afterPayArticle=params=>{
  return axios.post(`${base}wechat/wxApps/apiafterPayArticle?orderId=${params.orderId}&articleId=${params.articleId}`);
}
export const getAmount=params=>{
  return axios.post(`${base}wechat/wxApps/api/getAmount?openid=${params.openid}`);
}
